﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

    public static class EventLogHandler
    {
        static string ewSource = "Futureware - Tanmiya Send Messages";
        static string ewLog = "Application";

        public static void WriteMessageToLog(string Message)
        {
            if (!EventLog.SourceExists(ewSource))
                EventLog.CreateEventSource(ewSource, ewLog);
                        
            EventLog.WriteEntry(ewSource, Message, EventLogEntryType.Information);
        }

        public static void WriteMessageToLog(string Message, EventLogEntryType EventType)
        {
            if (!EventLog.SourceExists(ewSource))
                EventLog.CreateEventSource(ewSource, ewLog);

            EventLog.WriteEntry(ewSource, Message, EventType);
        }

        public static void WriteWarningToLog(string Message)
        {
            if (!EventLog.SourceExists(ewSource))
                EventLog.CreateEventSource(ewSource, ewLog);

            EventLog.WriteEntry(ewSource, Message, EventLogEntryType.Warning, 12000);
        }

        public static void WriteWarningToLog(string Message, int EventID)
        {
            if (!EventLog.SourceExists(ewSource))
                EventLog.CreateEventSource(ewSource, ewLog);

            EventLog.WriteEntry(ewSource, Message, EventLogEntryType.Warning, EventID);
        }
    }